<template>
  <vxe-modal
    :title="blogData.title"
    v-model="dialogVisible"
    v-if="dialogVisible"
    :loading="loading"
    width="60%" showFooter esc-closable show-zoom resize>

    <div style="height: 69vh; overflow-y: auto;">
      <el-card class="box-card" shadow="never" :body-style="{ padding: '10px',backgroundColor: '#bfcdda' }">
        <!-- 博客信息 -->
        <el-card class="box-card" shadow="hover">
          <div class="ql-container ql-snow" style="border: 1px solid #fff">
            <div class="ql-editor" style="font-size: 16px">
              <div v-html="blogData.content"/>
            </div>
          </div>
        </el-card>

      </el-card>
    </div>

    <div slot="footer" class="dialog-footer dialog-footer-center">
      <el-button @click="dialogVisible=false">关闭</el-button>
    </div>
  </vxe-modal>
</template>
<script>

import {getBlog} from "@/api/lundao/blog";

export default {
  name: "BlogDetail", //博客详情组件
  data() {
    return {
      loading: false,
      blogData: [], //博客信息
      blogId: null, //博客主键ID
      dialogVisible: false,
      content_style: {
        // 解决不对齐的问题
        'width': "400px",
        // 排列第二行
        'word-break': 'break-all',
        // 'background-color': '#f3f7ff'
      },
      label_style: {
        // 解决不对齐的问题
        'width': "250px",
        // 排列第二行
        'word-break': 'break-all',
      },
    };
  },
  created() {
  },
  methods: {
    handleOpen(row) {
      this.loading = true;
      this.blogId = row.blogId
      this.dialogVisible = true
      this.getDetail()
      setTimeout(() => {
        this.loading = false
      }, 1000)
    },
    //获取详情数据
    getDetail() {
      const blogId = this.blogId
      getBlog(blogId).then(res => {
        this.blogData = res.data
      })
    },


  }
};
</script>

<style scoped>
.right-align-label {
  text-align: right;
}
</style>

